/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Controller;

import java.awt.Point;

/**
 *
 * @author asouza, subx
 */
public class Edge {

    private int id;
    private int ide;
    private int weight;
    private Graph graph;

    private Point start;
    private Point end;
   

    /**
     * Construtor.
     * @param weight Peso da aresta.
     */
    public Edge(int weight){
        this.weight = weight;
        this.start = null;
        this.end = null;
    }

    public Edge () {
    }

    public Edge(int id, int ide, int weight, Graph grafo) {
        this.id = id;
        this.ide = ide;
        this.weight = weight;
        this.start = null;
        this.end = null;
        this.graph = grafo;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getIde() {
        return ide;
    }

    public void setIde (int ide) {
        this.ide = ide;
    }

    public int getWeight() {
        return weight;
    }

    
    public void setWeight(int weight) {
        this.weight = weight;
    }

    public Point getEnd() {
        return end;
    }

    public void setEnd(Point end) {
        this.end = end;
    }

    public Point getStart() {
        return start;
    }

    public void setStart(Point start) {
        this.start = start;
    }

    public Graph getGraph() {
        return graph;
    }

    public void setGraph(Graph graph) {
        this.graph = graph;
    }

    /**
     * Retorna o vertice que está do outro lado da aresta.
     * @param start - nó de partida da aresta
     * @return nó de chegada
     */

    public Node getMate (int start) {
        if (start == this.id) {
            return graph.getNode(ide);
        } else {
            return graph.getNode(id);
        }
    }

}
